﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsFormsApplication5.settings
{
    public class Static_Routerconfig
    {
        private bool defaultroute;       
        private bool staticroute;
        private string static_ip;
        private string static_subnetmask;
        private string static_nexthopip;

        /*
         * Getter und Setter
         */
        public bool Defaultroute
        {
            get { return defaultroute; }
            set { defaultroute = value; }
        }

        public bool Staticroute
        {
            get { return staticroute; }
            set { staticroute = value; }
        }

        public string Static_ip
        {
            get { return static_ip; }
            set { static_ip = value; }
        }

        public string Static_subnetmask
        {
            get { return static_subnetmask; }
            set { static_subnetmask = value; }
        }

        public string Static_nexthopip
        {
            get { return static_nexthopip; }
            set { static_nexthopip = value; }
        }

        public Static_Routerconfig(Boolean defaultroute, Boolean staticroute, String staticIp, String subnetMask, String nextHopIp)
        {
            Defaultroute = defaultroute;
            Staticroute = staticroute;
            Static_ip = staticIp;
            Static_subnetmask = subnetMask;
            Static_nexthopip = nextHopIp;
        }

        public Static_Routerconfig(MainForm formInstance)
        {
        }

        /**
         * Baut den Ausgabe-String für die Routing-Konfiguration zusammen
         * und gibt ihn zurück
         */
        public String toString()
        {
            String ret = "";
            if (Defaultroute == true)
            {
                ret += "ip rout 0.0.0.0 0.0.0.0 " + Static_ip + Environment.NewLine;
            }
            else
            {
                if (Static_ip != null && Static_subnetmask != null && Static_nexthopip != null)
                {
                    ret += "ip rout " + Static_ip + " " + Static_subnetmask + " " + Static_nexthopip + Environment.NewLine;
                }
            }

            return ret;
        }

    }
}
